import { Component } from 'react';
// import Router from '@/router/index';
// import { refreshUser } from '@/assets/js/utils/auth';
import { $catchError } from '@/assets/js/common';
import './app.scss';

class App extends Component {
  // componentDidMount() {}
  componentDidMount = () => {
    console.log('App componentDidMount');
  };

  onLaunch = async () => {
    console.log('App onLaunch');
    // 微信授权手机号登录信息初始化，刷新用户信息
    // await refreshUser();
  };

  componentDidShow() {}

  componentDidHide() {}

  // 对未处理的 Promise 拒绝事件监听函数
  onUnhandledRejection(res) {
    console.log('onUnhandledRejection :');
    $catchError(res?.reason || res);
  }

  // 当 App 报错时触发
  onError(err) {
    console.log('onError :');
    $catchError(err);
  }

  // this.props.children 是将要会渲染的页面
  // <Router url={window.location.href} />
  render() {
    return <>{this.props.children}</>;
  }
}
export default App;
